function [Xstruct] = buildX(linearFlag, borrowingLimit, xmax, I)
%{
%%-------------------------------------------------------------------------
Builds the grid for liquid assets
%%-------------------------------------------------------------------------
%}

    switch linearFlag
        case 1
            %Linear grid
            X_ = linspace(borrowingLimit, xmax, I)';
            xjump = X_(2) - X_(1);
            
        case 0
            %Non-linear grid (not written here)
            error('Use linear grid')
    end

    Xstruct = struct('borrowingLimit', borrowingLimit, ...
                     'xmax', xmax, ...
                     'xjump', xjump, ...
                     'X_', X_, ...
                     'I', I);
end
